package com.midian.model.activity;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.midian.model.common.BaseModel;
import com.midian.model.user.User;

/**
 * 图书评论
 * 
 */
@Entity
@Table(name = "activity_comment")
public class ActivityComment extends BaseModel {
	/**评论者id*/
	private String userId;
	/**活动id*/
	private String activityId;
	/**评论内容*/
	private String content;
	
	@OneToMany(mappedBy = "activityComment", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@NotFound(action=NotFoundAction.IGNORE)
	private Set<ActivityCommentPic> pics;
	
	
	@ManyToOne(optional = true,fetch=FetchType.LAZY)
	@JoinColumn(name="userId",insertable=false,updatable=false)
	@NotFound(action=NotFoundAction.IGNORE)
	private User user;
	
	@ManyToOne(optional = true,fetch=FetchType.LAZY)
	@JoinColumn(name="activityId",insertable=false,updatable=false)
	@NotFound(action=NotFoundAction.IGNORE)
	private Activity activity;

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getActivityId() {
		return activityId;
	}

	public void setActivityId(String activityId) {
		this.activityId = activityId;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Set<ActivityCommentPic> getPics() {
		return pics;
	}

	public void setPics(Set<ActivityCommentPic> pics) {
		this.pics = pics;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Activity getActivity() {
		return activity;
	}

	public void setActivity(Activity activity) {
		this.activity = activity;
	}
	
}
